package com.bdqn.ch05.sz.sz3;

import com.bdqn.ch05.sl.sl1.dao.UserDao;
import com.bdqn.ch05.sl.sl1.pojo.User;
import com.bdqn.ch05.sl.sl1.service.UserService;
import org.springframework.stereotype.Service;

@Service("userService")
public class UserServiceImpl implements UserService {
//    @Qualifier("dao")
//    @Autowired
//    @Resources
//    @Resources(name = "userDao")
//    @Resources(type = UserDaoImpl.class)
//    @Autowired
    private UserDao dao;

//    private UserDao dao = UserDaoFactory.getInstance();
//    @Override
//    public int save(User user) {
//       return dao.save(user);
//    }
    @Override
    public void save(User user) {
        dao.save(user);
    }
    public void setUserDao(UserDao userDao){
           this.dao = userDao;
    }

    public UserServiceImpl() {
    }

    public UserServiceImpl(UserDao userDao) {
        this.dao = userDao;
    }

}
